<template>
    <div>
        <!--<el-button @click="initAgencyInfo" style="margin: 20px;">初始化信息</el-button>-->
        <el-form style="width: 100%;margin: 20px;">
            <el-form-item label="当前下线总数">
                {{offLines.length}}人
            </el-form-item>
        </el-form>
        <el-table
                :data="offLines"
                style="width: 100%;margin: 20px;"
                row-key="rowKey"
                border>
            <el-table-column
                    prop="agencyName"
                    label="姓名">
            </el-table-column>
            <el-table-column
                    prop="userTelphone"
                    label="手机号码">
            </el-table-column>
            <el-table-column
                    prop="createdTime"
                    label="创建时间">
                <template slot-scope="scope">
                    {{formatDate(scope.row.createdTime)}}
                </template>
            </el-table-column>
        </el-table>

    </div>
</template>

<script>
    import {initAgentInfo} from '@/api/webagencyinfo'
    import rescueAgentApi from '@/api/rescueAgentApi'
    import {formatDate} from '@/utils/dateUtil'
  export default {
    name: 'index',
    data(){
      return {
        offLines:[],
      }
    },
    created(){
      this.getMyOffLine();
    },
    methods:{
      formatDate,
      initAgencyInfo(){
        initAgentInfo().then(resp=>{
          if(!resp.hasError){
            this.$message.success('操作成功！')
          }
        })
      },
      getMyOffLine(){
        rescueAgentApi.getMyOffLine(resp=>{
          this.offLines = resp||[];
        })
      }
    }
  }
</script>

<style scoped>

</style>
